Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

259
Visualizações
Using contentWindow.postMessage to control YouTube videos embedded in iframe--where can I find a list of "func"?

I'm new to front-end development so maybe this is a stupid question. I'm trying to write a program to control YouTube videos embedded using vanilla JavaScript. I found an example in this Control YouTube video with vanilla javascript link. I noticed the author uses contentWindow.postMessage() to send the command to the iframe.

For example, to play the YouTube video, the code is something like

div.getElementsByTagName("iframe")[0].contentWindow.postMessage('{"event":"command","func":"playVideo","args":""}', '*');

Where can I find a complete list of "func" (e.g. "playVideo")? I googled using keywords like "postMessage", "iframe", "playVideo", etc but couldn't find any documentation that answers my question.

I want to be able to control the YouTube video more precisely. In addition to playing/pausing the video, I want to be able to skip to a certain timestamp, control the volume, or even output only the left or right sound channel.

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda